package bus;

import java.util.ArrayList;

import dao.SubjectDao;
import dto.SubjectDto;

public class SubjectBus {

	public static ArrayList<SubjectDto> getSubjectByName(String subjectName) {
		ArrayList<SubjectDto> listSubject = new ArrayList<>();

		SubjectDao subjectDao = new SubjectDao();
		ArrayList<SubjectDto> listAllSubject = subjectDao.getAllSubject();
		
		for (SubjectDto subjectDto : listAllSubject) {
			if (subjectDto.getSubjectName().toLowerCase().contains(subjectName.toLowerCase()))
				listSubject.add(subjectDto);
		}

		return listSubject;
	}

}
